package com.example.mobile2021606170hsy0406homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class Main4Activity extends AppCompatActivity {

    private TextView tvMainTitle;
    private TextView tvMainDecode;
    private TextView tvMainAskfor;
    private TextView tvMainOriginal;
    private EditText edtTxtMainOriginal;
    private Button btMainResult;
    private EditText edtTxtMainResult;


    char c1='c';
    char c2='h';
    char c3='i';
    char c4='n';
    char c5='a';


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);
        initView();
    }

    private void initView() {
        tvMainTitle = findViewById(R.id.tv_main_title);
        tvMainDecode = findViewById(R.id.tv_main_decode);
        tvMainAskfor = findViewById(R.id.tv_main_askfor);
        tvMainOriginal = findViewById(R.id.tv_main_original);
        edtTxtMainOriginal = findViewById(R.id.edtTxt_main_original);
        btMainResult = findViewById(R.id.bt_main_result);
        edtTxtMainResult = findViewById(R.id.edtTxt_main_result);
    }
public  void resultonClick(View view){
        String a=edtTxtMainOriginal.getText().toString();
        if (a.equals("China")){
            c1+=4;
            c2+=4;
            c3+=4;
            c4+=4;
            c5+=4;
            char[ ] arr ={c1,c2,c3,c4,c5};
            edtTxtMainResult.setText(String.valueOf(arr));
        }else  if (a.length()==0){
            Toast.makeText(Main4Activity.this,"请输入字母",Toast.LENGTH_SHORT).show();
        }
}

}